#include <iostream>  
#include <stdarg.h>  
// 函数重载：计算两个整数的最大公约数  
int commonDivisor(int x1, int x2) {  
    while (x2 != 0) {  
        int temp = x2;  
        x2 = x1 % x2;  
        x1 = temp;  
    }  
    return x1;  
}  
  
// 函数重载：计算三个整数的最大公约数  
int commonDivisor(int x1, int x2, int x3) {  
    return commonDivisor(commonDivisor(x1, x2), x3);  
}  
  
// 函数重载：计算四个整数的最大公约数  
int commonDivisor(int x1, int x2, int x3, int x4) {  
    return commonDivisor(commonDivisor(x1, x2), commonDivisor(x3, x4));  
}  
  
int main() {  
     std::cout << "请输入2个整数: ";  
    int x1, x2;  
    std::cin >> x1 >> x2;  
    std::cout << "整数" << x1 << "," << x2 << "的最大公约数为: " << commonDivisor(x1, x2) << std::endl;  
  
    std::cout << "请输入3个整数: ";  
    int x3;  
    std::cin >>x1>>x2 >> x3;  
    std::cout << "整数" << x1 << "," << x2 << "," << x3 << "的最大公约数为: " << commonDivisor(x1, x2, x3) << std::endl;  
  
    std::cout << "请输入4个整数: ";  
    int x4;  
    std::cin >>x1>>x2>> x3>> x4;  
    std::cout << "整数" << x1 << "," << x2 << "," << x3 << "," << x4 << "的最大公约数为: " << commonDivisor(x1, x2, x3, x4) << std::endl;  
  
    return 0;  
}